"use client";

import { copyToClip } from "@/utils/common";

export default function CopyIcon({
  text,
  style,
}: {
  text: string;
  style: React.CSSProperties;
}) {
  return (
    <div
      title="复制"
      style={style}
      onClick={(e) => {
        e.stopPropagation();
        copyToClip(text, "复制成功");
      }}
    >
      <svg
        t="1712851283113"
        class="icon"
        viewBox="0 0 1024 1024"
        version="1.1"
        xmlns="http://www.w3.org/2000/svg"
        p-id="2163"
        width="16"
        height="16"
      >
        <path
          d="M720 192h-544A80.096 80.096 0 0 0 96 272v608C96 924.128 131.904 960 176 960h544c44.128 0 80-35.872 80-80v-608C800 227.904 764.128 192 720 192z m16 688c0 8.8-7.2 16-16 16h-544a16 16 0 0 1-16-16v-608a16 16 0 0 1 16-16h544a16 16 0 0 1 16 16v608z"
          p-id="2164"
          fill="#dbdbdb"
        ></path>
        <path
          d="M848 64h-544a32 32 0 0 0 0 64h544a16 16 0 0 1 16 16v608a32 32 0 1 0 64 0v-608C928 99.904 892.128 64 848 64z"
          p-id="2165"
          fill="#dbdbdb"
        ></path>
        <path
          d="M608 360H288a32 32 0 0 0 0 64h320a32 32 0 1 0 0-64zM608 520H288a32 32 0 1 0 0 64h320a32 32 0 1 0 0-64zM480 678.656H288a32 32 0 1 0 0 64h192a32 32 0 1 0 0-64z"
          p-id="2166"
          fill="#dbdbdb"
        ></path>
      </svg>
    </div>
  );
}
